package com.testitems.controller.interfaceDetection;

import com.testitems.common.web.result.Result;
import com.testitems.repo.request.SendRequest;
import com.testitems.repo.request.SingleInterfaceListReq;
import com.testitems.service.interfaceDetection.SingleInterfaceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@Api(tags = "接口测试")
@RestController
@RequestMapping("/api/singleInterface")
public class singleInterfaceController {

    @Autowired
    private SingleInterfaceService singleInterfaceService;

    @PostMapping("/sendRequest")
    @ApiOperation(value = "单接口测试请求发送")
    public Result sendRequest(@RequestBody SendRequest sendRequest) {
        Result result = singleInterfaceService.sendRequest(sendRequest);
        return result;
    }

    @PostMapping("/singleInterfaceList")
    @ApiOperation(value = "单接口执行情况列表")
    public Result singleInterfaceList(@RequestBody SingleInterfaceListReq singleInterfaceListReq) {
        Result result = singleInterfaceService.singleInterfaceList(singleInterfaceListReq);
        return result;
    }


}
